#ifndef H_DRAWABLE
#define H_DRAWABLE

#include "sprite.h"
#include "list.h"
#include "rect.h"

//Each drawable has its own rect
class Drawable : public Listable {
   private:
      Sprite* sprite;
      Rect* posRect; // a rect for its position on the screen
   public:

      Drawable () {
	 sprite = NULL;
	 posRect = new Rect();
	 }

      Drawable ( Sprite* );

      Sprite* getSprite () {	 //#D
	 return sprite;
      }
      
      Rect* getPosRect () {	 //#D
	 if (sprite == NULL) return posRect;
	 if (!sprite->animated) return posRect;
	 posRect->w = sprite->getGeometry()->w;
	 posRect->h = sprite->getGeometry()->h;
	 return posRect;
      }

      virtual void advance() {	   //#D
      }

      virtual Rect* getGeometryRect () {	 //#D
	 if (sprite == NULL) return NULL;
	 return sprite->getGeometry();
      }

};

class DrawableList: public List {
   public:
      DrawableList () : List() {}
      void add ( Drawable* );
      virtual Drawable * iter ();
};

#endif
